<template>
  <div class="home">
    <NavBar />
    
    <!-- 英雄区域 -->
    <header class="hero">
      <div class="hero-content">
        <h1 class="title">XappTool - 免邀请码安装归因专家</h1>
        <p class="subtitle">APP 免邀请码安装的专业级解决方案</p>
        <p class="description">
          无需用户填写邀请码，自动获取安装参数，精准识别APP安装来源，
          支持多平台开发，提升用户体验，助力业务增长
        </p>

        <div class="buttons">
          <button class="btn btn-primary" @click="goto('/console')">立即使用</button>
          <button class="btn btn-secondary" @click="goto('/price')">服务价格</button>
          <button class="btn btn-outline" @click="goto('/docs')">技术文档</button>
        </div>
        
        <div class="stats">
          <div class="stat-item">
            <div class="stat-number">99.9%</div>
            <div class="stat-label">归因准确率</div>
          </div>
          <div class="stat-item">
            <div class="stat-number">1000万+</div>
            <div class="stat-label">日处理量</div>
          </div>
          <div class="stat-item">
            <div class="stat-number">50ms</div>
            <div class="stat-label">平均响应时间</div>
          </div>
        </div>
      </div>
    </header>

    

    <!-- 免填邀请码安装原理 -->
    <section class="principle">
      <div class="container">
        <h2 class="section-title">免填邀请码安装原理</h2>
        <div class="principle-content">
          <div class="principle-steps">
            <div class="step" v-for="(step, index) in principleSteps" :key="index">
              <div class="step-number">{{ index + 1 }}</div>
              <div class="step-content">
                <h3>{{ step.title }}</h3>
                <p>{{ step.description }}</p>
              </div>
            </div>
          </div>
          <div class="principle-diagram">
            <div class="diagram-item">用户点击分享链接</div>
            <div class="arrow">→</div>
            <div class="diagram-item">系统记录设备指纹</div>
            <div class="arrow">→</div>
            <div class="diagram-item">用户安装APP</div>
            <div class="arrow">→</div>
            <div class="diagram-item">自动匹配归因</div>
            <div class="arrow">→</div>
            <div class="diagram-item">建立邀请关系</div>
          </div>
        </div>
      </div>
    </section>

    <!-- 技术架构 -->
    <section class="architecture">
      <div class="container">
        <h2 class="section-title">技术架构优势</h2>
        <div class="architecture-grid">
          <div class="arch-item" v-for="(arch, index) in architecture" :key="index">
            <div class="arch-icon">{{ arch.icon }}</div>
            <h3>{{ arch.title }}</h3>
            <p>{{ arch.description }}</p>
          </div>
        </div>
      </div>
    </section>


    <!-- 集成文档 -->
    <section class="integration">
      <div class="container">
        <h2 class="section-title">快速集成</h2>
        <p class="section-subtitle">支持多平台开发，5分钟完成集成</p>
        <div class="platforms">
          <div class="platform" v-for="(platform, index) in platforms" :key="index">
            <div class="platform-icon">{{ platform.icon }}</div>
            <h3>{{ platform.name }}</h3>
            <p>{{ platform.description }}</p>
            <code class="platform-code">{{ platform.code }}</code>
          </div>
        </div>
        <div class="integration-cta">
          <button class="btn btn-primary" @click="goto('/docs')">查看完整文档</button>
        </div>
      </div>
    </section>

    <!-- 客户案例 -->
    <section class="testimonials">
      <div class="container">
        <h2 class="section-title">客户成功案例</h2>
        <div class="testimonials-grid">
          <div class="testimonial" v-for="(testimonial, index) in testimonials" :key="index">
            <div class="testimonial-content">{{ testimonial.content }}</div>
            <div class="testimonial-author">
              <div class="author-name">{{ testimonial.author }}</div>
              <div class="author-title">{{ testimonial.title }}</div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- CTA区域 -->
    <section class="cta">
      <div class="container">
        <h2>立即开始您的免邀请码安装之旅</h2>
        <p>专业技术支持，7×24小时服务保障</p>
        <div class="cta-buttons">
          <button class="btn btn-primary btn-large" @click="goto('/console')">免费试用</button>
          <button class="btn btn-outline btn-large" @click="goto('/docs')">技术文档</button>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
import NavBar from '@/components/NavBarEnhanced.vue';

export default {
  components: {
    NavBar
  },
  data() {
    return {
      principleSteps: [
        {
          title: '分享链接生成',
          description: '为每个用户生成唯一的分享链接，包含用户标识和渠道信息'
        },
        {
          title: '设备指纹采集',
          description: '用户点击链接时，采集设备多维度的指纹信息'
        },
        {
          title: 'APP安装检测',
          description: '用户安装APP后，SDK自动采集设备指纹并上传'
        },
        {
          title: '智能匹配归因',
          description: '通过设备指纹匹配算法，找到对应的分享来源'
        },
        {
          title: '关系建立',
          description: '自动建立邀请关系，无需用户手动输入邀请码'
        }
      ],
      architecture: [
        {
          icon: '🌐',
          title: '分布式架构',
          description: '采用微服务架构，支持水平扩展，轻松应对高并发场景'
        },
        {
          icon: '🧠',
          title: '智能算法',
          description: '机器学习算法持续优化归因准确率，自适应不同场景'
        },
        {
          icon: '📊',
          title: '实时分析',
          description: '实时数据统计分析，提供详细的渠道效果报告'
        },
        {
          icon: '🔧',
          title: '易于集成',
          description: '提供多平台SDK，简单几行代码即可完成集成'
        }
      ],
      pricingPlans: [
        {
          name: '免费版',
          price: '¥0',
          period: '/月',
          features: [
            '1万次日归因',
            '基础设备指纹',
            '标准技术支持',
            '7天数据保留'
          ]
        },
        {
          name: '专业版',
          price: '¥299',
          period: '/月',
          features: [
            '10万次日归因',
            '高级设备指纹',
            '反作弊检测',
            '30天数据保留',
            '优先技术支持'
          ]
        },
        {
          name: '企业版',
          price: '¥999',
          period: '/月',
          features: [
            '100万次日归因',
            '企业级设备指纹',
            '高级反作弊',
            '90天数据保留',
            '专属客户经理',
            '定制化服务'
          ]
        }
      ],
      platforms: [
        {
          icon: '⚛️',
          name: 'React SDK',
          description: '专为React应用优化，提供React Hooks',
          code: 'npm install @xapptool/react'
        },
        {
          icon: '📱',
          name: 'UniApp SDK',
          description: '支持微信小程序、H5、App等多端',
          code: 'npm install @xapptool/uniapp'
        },
        {
          icon: '🤖',
          name: 'Android SDK',
          description: '原生Android开发，Java/Kotlin支持',
          code: 'implementation "com.xapptool:sdk:latest"'
        },
        {
          icon: '🍎',
          name: 'iOS SDK',
          description: '原生iOS开发，Swift/Objective-C支持',
          code: 'pod "XappTool-iOS-SDK"'
        }
      ],
      testimonials: [
        {
          content: 'XappTool帮助我们解决了用户邀请码填写的痛点，安装转化率提升了35%，用户体验大幅改善。',
          author: '张经理',
          title: '某电商平台产品总监'
        },
        {
          content: '归因准确率非常高，技术支持响应及时，为我们节省了大量的开发时间和成本。',
          author: '李技术',
          title: '某社交APP技术负责人'
        },
        {
          content: '反作弊功能很强大，有效识别了大量虚假安装，帮助我们节省了大量的推广费用。',
          author: '王运营',
          title: '某游戏公司运营总监'
        }
      ]
    };
  },
  methods: {
    goto (path){
      this.$router.push(path);
    }
  }
};
</script>

<style scoped>
.home {
  min-height: 100vh;
}

.container {
  width: 100%;
  margin: 0;
  padding: 0 2rem;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  color: #2a2a2a;
  margin-bottom: 1rem;
}

.section-subtitle {
  text-align: center;
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

/* 英雄区域 */
.hero {
  padding: 6rem 2rem;
  background: #ffffff;
  color: #303133;
  text-align: center;
  border-bottom: 1px solid #e4e7ed;
}

.hero-content {
  width: 100%;
  margin: 0 auto;
}

.title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.subtitle {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #606266;
}

.description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: #606266;
  line-height: 1.6;
}

.buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.btn {
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: #ff6b6b;
  color: white;
}

.btn-primary:hover {
  background: #ff5252;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #eef2ff;
  color: #303133;
  border: 1px solid #e4e7ed;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-outline {
  background: transparent;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn-outline:hover {
  background: white;
  color: #667eea;
}

.btn-large {
  padding: 1rem 3rem;
  font-size: 1.1rem;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* 功能特性 */


/* 工作原理 */
.principle {
  padding: 6rem 0;
  background: white;
}

.principle-content {
  margin-top: 3rem;
}

.principle-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step-number {
  width: 40px;
  height: 40px;
  background: #667eea;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.step-content h3 {
  color: #2a2a2a;
  margin-bottom: 0.5rem;
}

.step-content p {
  color: #666;
  line-height: 1.6;
}

.principle-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 1rem;
}

.diagram-item {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

.arrow {
  color: #667eea;
  font-size: 1.5rem;
  font-weight: bold;
}

/* 技术架构 */
.architecture {
  padding: 6rem 0;
  background: #f8f9fa;
}

.architecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.arch-item {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.arch-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.arch-item h3 {
  color: #2a2a2a;
  margin-bottom: 1rem;
}

.arch-item p {
  color: #666;
  line-height: 1.6;
}

/* 价格预览 */
.pricing-preview {
  padding: 6rem 0;
  background: white;
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.pricing-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 1rem;
  padding: 2.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.pricing-card:hover {
  border-color: #667eea;
  transform: translateY(-5px);
}

.plan-header {
  margin-bottom: 2rem;
}

.plan-header h3 {
  color: #2a2a2a;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.price {
  font-size: 2.5rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.5rem;
}

.period {
  color: #666;
  font-size: 0.9rem;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  text-align: left;
}

.plan-features li {
  color: #666;
  margin-bottom: 0.8rem;
  position: relative;
  padding-left: 1.5rem;
}

.plan-features li:before {
  content: "✓";
  color: #4caf50;
  position: absolute;
  left: 0;
}

/* 集成平台 */
.integration {
  padding: 6rem 0;
  background: #f8f9fa;
}

.platforms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.platform {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.platform-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.platform h3 {
  color: #2a2a2a;
  margin-bottom: 1rem;
}

.platform p {
  color: #666;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.platform-code {
  background: #f8f9fa;
  padding: 0.8rem;
  border-radius: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: #495057;
  display: block;
}

.integration-cta {
  text-align: center;
  margin-top: 3rem;
}

/* 客户案例 */
.testimonials {
  padding: 6rem 0;
  background: white;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.testimonial {
  background: #f8f9fa;
  padding: 2.5rem;
  border-radius: 1rem;
  position: relative;
}

.testimonial-content {
  color: #495057;
  font-style: italic;
  line-height: 1.8;
  margin-bottom: 2rem;
  position: relative;
}

.testimonial-content:before {
  content: '"';
  font-size: 4rem;
  color: #667eea;
  position: absolute;
  top: -1rem;
  left: -1rem;
  opacity: 0.3;
}

.testimonial-author {
  text-align: right;
}

.author-name {
  font-weight: 600;
  color: #2a2a2a;
  margin-bottom: 0.2rem;
}

.author-title {
  color: #666;
  font-size: 0.9rem;
}

/* CTA区域 */
.cta {
  padding: 6rem 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
}

.cta h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.cta p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero {
    padding: 4rem 1rem;
  }
  
  .title {
    font-size: 2.5rem;
  }
  
  .subtitle {
    font-size: 1.2rem;
  }
  
  .buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .stats {
    flex-direction: column;
    gap: 2rem;
  }
  
  .architecture-grid,
  .pricing-cards,
  .platforms,
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
  
  .principle-steps {
    grid-template-columns: 1fr;
  }
  
  .principle-diagram {
    flex-direction: column;
  }
  
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .container {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  .pricing-card,
  .feature,
  .arch-item,
  .platform,
  .testimonial {
    padding: 1.5rem;
  }
}
</style>